﻿package com.saint.video.videoControls {
	
	import com.saint.utils.Logger;
	import com.saint.utils.events.ActiveMouseAreaEvent;
	import com.saint.utils.ui.GraphicBttn;
	import com.saint.utils.ui.ActiveMouseArea;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	public class VolumeControl extends Sprite {
		
		private var volIcon:	volumeIcon;
		private var volGrfx:	volumeFill;
		private var volMask:	volumeMask;
		private var volHitArea:	ActiveMouseArea;
		
		public function VolumeControl():void{
			Logger.info("VolumeControl loaded");
			
			volIcon = new volumeIcon();
			volGrfx = new volumeFill();
			volMask = new volumeMask();
			volHitArea = new ActiveMouseArea(volMask.width, volMask.height);
			
			volGrfx.x = volMask.x = volHitArea.x = volIcon.x + volIcon.width;
			volGrfx.mask = volMask;
			
			addChild(volIcon);
			addChild(volGrfx);
			addChild(volMask);
			addChild(volHitArea);
			
			volHitArea.addEventListener(ActiveMouseAreaEvent.MOUSE_MOVE, mouseHandler, false, 0, true);
		}
		
		private function mouseHandler(event:ActiveMouseAreaEvent):void {
			volGrfx.scaleX = event.data;
			dispatchEvent(new ActiveMouseAreaEvent(ActiveMouseAreaEvent.MOUSE_MOVE, event.data));
		}
		
	}
}